﻿using System;
using DBCore.DB;

namespace DBCore.Attr
{
    /// <summary>
    /// 实体特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    
    public class EntityPropertyAttribute : System.Attribute
    {
        /// <summary>
        /// 对应数据字段名称
        /// </summary>
        public string SqlName { get; set; }
        /// <summary>
        /// 数据类型
        /// </summary>
        public DbDataType DataType { get; set; }
        /// <summary>
        /// 是否为Table中的数据
        /// </summary>
        public bool IsDbColumn { get; set; }
        public EntityPropertyAttribute()
        {
            IsDbColumn = true;
        }
        public EntityPropertyAttribute(string sqlname)
        {
            SqlName = sqlname;
            IsDbColumn = true;
        }
        public EntityPropertyAttribute(string sqlname,bool iscolumn)
        {
            SqlName = sqlname;
            IsDbColumn = iscolumn;
        }
        public EntityPropertyAttribute(string sqlname,DbDataType datatype)
        {
            SqlName = sqlname;
            DataType = datatype;
            IsDbColumn = true;
        }
        public EntityPropertyAttribute(string sqlname, DbDataType datatype, bool iscolumn)
        {
            SqlName = sqlname;
            DataType = datatype;
            IsDbColumn = iscolumn;
        }
    }
}
